package labox.innovation.loginserver.socket.serverpackets;

/**
 * 登陆失败信息
 * 
 */
public final class LoginFail extends LoginServerPacket {
	
	public static enum LoginFailReason {
		REASON_SYSTEM_ERROR(0x00), 
		REASON_USER_OR_PASS_WRONG(0x01), 
		REASON_ACCESS_FAILED(0x02), 
		REASON_ACCOUNT_IN_USE(0x03), 
		REASON_SERVER_OVERLOADED(0x04), 
		REASON_PERMANENTLY_BANNED(0x05),
		REASON_VERSION_ERROR(0x06);

		private final LoginFail _code;

		LoginFailReason(int code) {
			_code = new LoginFail(code);
		}

		public final LoginFail getLoginFail() {
			return _code;
		}
	}

	private int _reason;

	private LoginFail(int reason) {
		_reason = reason;
	}

	/**
	 * @see com.l2jserver.mmocore.network.SendablePacket#write()
	 */
	@Override
	public void write() {
		writeByte(PTL_LOGINFAIL);
		writeByte(_reason);
	}
}
